

#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;

class Solution
{
public:
    int characterReplacement(string s, int k)
    {
        int res = 0;
        int cnt[26] = { 0 };
        int maxsame = 0, n = s.size();

        for (int lf = 0, rg = 0; rg < n; ++rg)
        {
            maxsame = max(maxsame, ++cnt[s[rg] - 'A']);

            if (maxsame + k < rg - lf + 1)
            {
                --cnt[s[lf] - 'A'];
                ++lf;
            }
            res = max(res, rg - lf + 1);
        }

        return res;
    }

    int maxProduct1(vector<int>& nums)
    {
        int firmax = 0, secmax = 0;

        for (auto e : nums)
        {
            if (e > firmax)
            {
                secmax = firmax;
                firmax = e;
            }
            else if (e > secmax)
            {
                secmax = e;
            }
        }

        return (firmax - 1) * (secmax - 1);
    }

    int maxProduct2(vector<int>& nums)
    {
        int res = 1;
        priority_queue<int, vector<int>, greater<int>> hp;

        for (auto e : nums)
        {
            if (hp.size() < 2)
                hp.push(e);
            else
            {
                if (e >= hp.top())
                {
                    hp.pop();
                    hp.push(e);
                }
            }
        }

        for (int i = 0; i < 2; ++i)
        {
            res *= hp.top() - 1;
            hp.pop();
        }

        return res;
    }

    int maxProduct3(vector<int>& nums)
    {
        sort(nums.begin(), nums.end());

        int max1 = *nums.rbegin(), max2 = *(++nums.rbegin());

        return (max1 - 1) * (max2 - 1);
    }
};

int main()
{


	return 0;
}